Skip to content

fix: correct comment syntax for external tables in GPDB 7+ and Cloudberry#74

Merged
tuhaihe merged 1 commit intoapache:mainfrom
robertmu:fix-table-comment
Mar 2, 2026
Merged

fix: correct comment syntax for external tables in GPDB 7+ and Cloudberry#74
tuhaihe merged 1 commit intoapache:mainfrom
robertmu:fix-table-comment

Conversation

@robertmu
Copy link
Contributor

@robertmu robertmu commented Feb 28, 2026

In GPDB 7.0+ and Cloudberry Database, external tables are implemented as foreign tables under the hood. When gpbackup exports metadata for an external table with a comment, using the traditional "TABLE" object type causes an error during gprestore because the database expects "FOREIGN TABLE" syntax for these objects.

This change updates the GetMetadataEntry logic to correctly identify external tables as "FOREIGN TABLE" in newer database versions.

SQL Comparison:

Before (Fails on GPDB 7+ / Cloudberry):

COMMENT ON TABLE public.my_ext_table IS 'this is an external table comment';

After (Executes successfully):

COMMENT ON FOREIGN TABLE public.my_ext_table IS 'this is an external table comment';

@tuhaihe tuhaihe force-pushed the fix-table-comment branch from 4154bb3 to fa610ed Compare March 2, 2026 02:41
…erry

In GPDB 7.0+ and Cloudberry Database, external tables are implemented as
foreign tables under the hood. When gpbackup exports metadata for an
external table with a comment, using the traditional "TABLE" object type
causes an error during gprestore because the database expects
"FOREIGN TABLE" syntax for these objects.

This change updates the GetMetadataEntry logic to correctly identify
external tables as "FOREIGN TABLE" in newer database versions.

SQL Comparison:

Before (Fails on GPDB 7+ / Cloudberry):
--------------------------------------------------
COMMENT ON TABLE public.my_ext_table IS 'this is an external table comment';

After (Executes successfully):
--------------------------------------------------
COMMENT ON FOREIGN TABLE public.my_ext_table IS 'this is an external table comment';
@tuhaihe tuhaihe force-pushed the fix-table-comment branch from fa610ed to 18a85dd Compare March 2, 2026 10:16
@tuhaihe tuhaihe merged commit 578dbf6 into apache:main Mar 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants